ChatbotViewModel

class ChatbotViewModel @Inject constructor(chatRepository: ChatRepository) : ViewModel

ViewModel responsible for managing chatbot interactions. Handles message processing, chat logs, and user interactions.

Constructors

Link copied to clipboard
@Inject
constructor(chatRepository: ChatRepository)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open fun addCloseable(closeable: AutoCloseable)
fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard

Adds a chat log to the repository and clears the current branch messages.

fun addCurrentBranchLog(messageList: List<ChatMessage>, logType: ChatBranch, toBeCompleted: Date? = null)

Creates and adds a new chat log based on a list of messages. It makes a copy of the provided message list before storing it.

Link copied to clipboard
fun deleteLog(id: String)

Deletes a chat log based on its ID.

Link copied to clipboard

Retrieves a list of all available chat branches.

Link copied to clipboard

Retrieves the current step in the chatbot's branching logic.

Link copied to clipboard
Link copied to clipboard

Retrieves the currently active chat branch or dialogue.

Link copied to clipboard
fun getLog(id: String): ChatLog?

Retrieves a specific chat log based on its ID.

Link copied to clipboard
fun sendCompletionDate(selectedDate: Date?)

Sends a completion date for a chat log if applicable.

Link copied to clipboard
fun sendMessage(userMessage: String)

Sends a message from the user to the chatbot. Also triggers the chatbot's response simulation.